package com.qiche.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qiche.model.Evaluation;
import com.qiche.model.Product;
import com.qiche.model.SpecialOffer;
import com.qiche.model.User;
import com.qiche.service.EvaluationService;
import com.qiche.util.UserUtils;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * Created by Linzw on 2018/01/24.
 */
@Service("evaluationService")
public class EvaluationServiceImpl extends BaseService<Evaluation> implements EvaluationService {

    @Override
    public PageInfo<Evaluation> selectByPage(int page, int limit) {
        User user= UserUtils.getCurrentUser();
        Example example=new Example(Evaluation.class);
        Example.Criteria criteria=example.createCriteria();
        criteria.andEqualTo("merchantId",user.getMerchantId());
        PageHelper.startPage(page, limit);
        List<Evaluation> evaluationList=mapper.selectByExample(example);
        return new PageInfo<>(evaluationList);
    }
}
